package com.example.cofeed.adapter;

import com.blankj.utilcode.util.ObjectUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.cofeed.R;
import com.example.cofeed.entity.Attention;

/**
 * Created by mqwang on 2017/11/15.
 */

public class SubMoreAdapter extends BaseQuickAdapter<Attention, BaseViewHolder> {

    public SubMoreAdapter() {
        super(R.layout.item_sub_more);
    }

    @Override
    protected void convert(BaseViewHolder helper, final Attention item) {
        if (item.ispush == 0){
            helper.setImageResource(R.id.push_switch, R.mipmap.closebutn);
        } else{
            helper.setImageResource(R.id.push_switch, R.mipmap.openbutn);
        }

        if (ObjectUtils.isNotEmpty(item.catname)){
            helper.setText(R.id.name_tv, item.chname);
        }else {
            helper.setText(R.id.name_tv, item.name);
        }

    }

    public void setSelect(Attention select){
        if (select.ispush == 0) {
            select.ispush = 1;
        } else {
            select.ispush = 0;
        }
        notifyDataSetChanged();
    }


}
